package com.government.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;


@Getter
public enum SmTemplateCode {


    /**
     * 注册
     */
    REGISTER(1, "register", false, "注册"),
    /**
     * 忘记密码
     */
    FORGET_PASS(2, "forgetPass", false, "忘记密码"),
    /**
     * 登录
     */
    SIGN_IN(3, "signIn", false, "登录"),

    ;


    /**
     * 模板代码
     */
    private int code;

    /**
     * 模板类型
     */
    private String type;

    /**
     * 是否可以直接接口检验
     */
    private boolean isVerify;

    /**
     * 描述
     */
    private String desc;


    /**
     * 可直接发送模板
     */
    private final static List<SmTemplateCode> CANSENDLIST = Arrays.asList(REGISTER,SIGN_IN,FORGET_PASS);

    public final static List<SmTemplateCode> NOT_NEED_CHECK = Arrays.asList(REGISTER);

    private SmTemplateCode(int code, String type, boolean isVerify, String desc) {
        this.code = code;
        this.type = type;
        this.isVerify = isVerify;
        this.desc = desc;
    }

    public static SmTemplateCode canSend(int code){
        for (SmTemplateCode temCode:CANSENDLIST){
            if (code==temCode.getCode()){
                return temCode;
            }
        }
        return null;
    }



    public static SmTemplateCode getSmTemplate(int code){
        SmTemplateCode[] values = SmTemplateCode.values();
        for (SmTemplateCode temCode:values){
            if (code==temCode.getCode()){
                return temCode;
            }
        }
        return null;
    }
}
